public class BinarySearchTree {
	private Node root;
	private Node cur;

	public BinarySearchTree() {
		cur = null;
		root = null;
	}

	public BinarySearchTree(char value) {
		Node tree = new Node(value);
		cur = tree;
		root = tree;
	}

	public char getCurValue() {
		return this.cur.getValue();
	}

	public void setCurLeft(Node left) {
		this.cur = this.cur.getLeft();
	}

	public void setCurRight(Node right) {
		this.cur = this.cur.getRight();
	}

	public void setCurRoot(Node root) {
		this.cur = this.root;
	}

	public void add(char value) {
		Node tree = new Node(value);
		cur = tree;
		root = tree;
		while (true) {
			if(cur.getValue()==value){
				return; 
			}
			if (cur.getValue() > value) {
				if (cur.getLeft() == null)
					cur.setLeft(tree);
				else
					cur = cur.getLeft();
			} else {
				if (cur.getValue() < value) {
					if (cur.getRight() == null)
						cur.setRight(tree);
					else
						cur = cur.getRight();
				}
			}
		}

	}

}
